﻿using System;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Entities.Users;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Services.Search;
using System.Collections.Generic;
using System.Data;


namespace DotNetNuke.Modules.PersonalAssistants
{
    ///<summary>
    /// This information object holds the information on a single guestbook entry
    ///</summary>
    public class MailDetails : PersonalAssistantsSettingsBase
    {
        #region Private Data Members
            private string _adminEmail;
            private string _createdSubject;
            private string _createdbody;
            private string _updatedSubject;
            private string _updatedBody;
            private string _approvedSubject;
            private string _approvedBody;
            private bool _mailDetailsComplete;
            private string _sendEmailsOut;
        #endregion

        #region Public Constructors

        public MailDetails()
        {
            //Initalize any needed values
            _mailDetailsComplete = true;
            object paAdminEmail = ModuleSettings["PersonalAssistantsAdminEmail"];
            if (paAdminEmail != null)
                _adminEmail = paAdminEmail.ToString();
            else
                _mailDetailsComplete = false;

            object paCreatedSubject = ModuleSettings["PersonalAssistantsCreatedSubject"];
            if (paCreatedSubject != null)
                _createdSubject = paCreatedSubject.ToString();
            else
                _mailDetailsComplete = false;

            object paCreatedBody = ModuleSettings["PersonalAssistantsCreatedBody"];
            if (paCreatedBody != null)
                _createdbody = paCreatedBody.ToString();
            else
                _mailDetailsComplete = false;

            object paUpdatedSubject = ModuleSettings["PersonalAssistantsUpdatedSubject"];
            if (paUpdatedSubject != null)
                _updatedSubject = paUpdatedSubject.ToString();
            else
                _mailDetailsComplete = false;

            object paUpdatedBody = ModuleSettings["PersonalAssistantsUpdatedBody"];
            if (paUpdatedBody != null)
                _updatedBody = paUpdatedBody.ToString();
            else
                _mailDetailsComplete = false;

            object paApprovedSubject = ModuleSettings["PersonalAssistantsApprovedSubject"];
            if (paApprovedSubject != null)
                _approvedSubject = paApprovedSubject.ToString();
            else
                _mailDetailsComplete = false;

            object paApprovedBody = ModuleSettings["PersonalAssistantsApprovedBody"];
            if (paApprovedBody != null)
                _approvedBody = paApprovedBody.ToString();
            else
                _mailDetailsComplete = false;

            object paSendEmailsOut = ModuleSettings["PersonalAssistantsSendEmailsOut"];
            if (paSendEmailsOut != null)
                _sendEmailsOut = paSendEmailsOut.ToString();
            else
                _mailDetailsComplete = false;


        }
        #endregion

        #region Public Properties
        /// <summary>
        /// The unique identifier for an entry
        /// </summary>
        /// 
        public bool MailDetailsComplete {
            get { return _mailDetailsComplete; }
            set { _mailDetailsComplete = value; }
        }
        public string AdminEmail {
            get { return _adminEmail; }
            set { 
              _adminEmail = value;
              ModuleController modules = new ModuleController();
              modules.UpdateModuleSetting(this.ModuleId, "PersonalAssistantsAdminEmail", _adminEmail);

            }
        }
        public string SendEmailsOut
        {
            get { 
                
                return _sendEmailsOut; }
            set
            {
                _sendEmailsOut = value;
                ModuleController modules = new ModuleController();
                modules.UpdateModuleSetting(this.ModuleId, "PersonalAssistantsSendEmailsOut", _sendEmailsOut.ToString());

            }
        }


        public string CreatedBody {
            get { return _createdbody; }
            set { 
                _createdbody = value;
                ModuleController modules = new ModuleController();
                modules.UpdateModuleSetting(this.ModuleId, "PersonalAssistantsCreatedBody", _createdbody);

            }
        }
        public string CreatedSubject
        {
            get { return _createdSubject; }
            set { _createdSubject = value;
                ModuleController modules = new ModuleController();
                modules.UpdateModuleSetting(this.ModuleId, "PersonalAssistantsCreatedSubject", _createdSubject);
            
            }
        }


        public string UpdatedSubject
        {
            get { return _updatedSubject; }
            set { _updatedSubject = value;
                ModuleController modules = new ModuleController();
                modules.UpdateModuleSetting(this.ModuleId, "PersonalAssistantsUpdatedSubject", _updatedSubject);
            
            }
        }
        public string UpdatedBody
        {
            get { return _updatedBody; }
            set { _updatedBody = value;
                ModuleController modules = new ModuleController();
                modules.UpdateModuleSetting(this.ModuleId, "PersonalAssistantsUpdatedBody", _updatedBody);
            
            }
        }
        public string ApprovedSubject
        {
            get { return _approvedSubject; }
            set { _approvedSubject = value;
                ModuleController modules = new ModuleController();
                modules.UpdateModuleSetting(this.ModuleId, "PersonalAssistantsApprovedSubject", _approvedSubject);
            
            }
        }
        public string ApprovedBody
        {
            get { return _approvedBody; }
            set { _approvedBody = value;
                ModuleController modules = new ModuleController();
                modules.UpdateModuleSetting(this.ModuleId, "PersonalAssistantsApprovedBody", _approvedBody);
            
            }
        }

        #endregion

        #region IHydratable Implementation


        #endregion


    }
}
